export let personalized = {
  namespaced: true,
  state: {
    personalized_data: {}
  },
  actions: {
    getPersonalizedData(store, data = {}) {
      let url = "/personalized?limit=" + data.limit + "&offset=" + (data.offset - 1) * data.limit;
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit("setPersonalizedData", data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            // 请求已发出，但服务器响应的状态码不在 2xx 范围内
            reject(error.response.data)
          }
        });
      });
    }
  },
  mutations: {
    setPersonalizedData(state, data = {}) {
      state.personalized_data = data;
    }
  }
};
